@extends("/paging_template",minWidth=1000,title="产品初始入库")
@import com.mgfireworks.mgplatform.mgadmin.constants.*
@import com.mgfireworks.mgplatform.mgadmin.product.model.*
@import com.mgfireworks.mgplatform.mgadmin.sys.model.*
@args List<Product> productList,List<Category> categoryList,List<SellLevel> sellLevelList
<s_panel>
	<s_input name="productId" text="产品编号" value="@val("productId")"></s_input>
	<s_input name="productName" text="产品名" value="@val("productName")"></s_input>
	<s_select name="cateId" text="类别" value="@val("cateId")">
	@if(categoryList){@for(Category c : categoryList){
		<option value="@c.getCateId()">@c.getCateName()</option>
	}}
	</s_select>
	<s_select name="sellLevel" text="销售级别" value="@val("sellLevel")">
	@if(sellLevelList){@for(SellLevel s : sellLevelList){
		<option value="@s.getLevel()">@s.getLevelName()</option>
	}}
	</s_select>
	<s_buttons slot="button" cols="1">
		<s_button type="query"></s_button>
	</s_buttons>
</s_panel>

<div class="row">
	@if(productList){
	@{int i=0;}
	@for(Product p : productList){
    <div class="product-item col col-sm-12 col-md-12 col-xs-12 col-lg-4">
		<input type="checkbox" name="productId" value="@p.getProductId()"/>
        <div class="thumbnail" style="height: auto;">
            <a href="?">
                <img src="@url(p.getMainImg())" alt="@p.getProductName()">
            </a>
            <div class="caption">
                <div class="pi-info">
                    <h3>@p.getProductName()</h3>
                    <p>类别：@p.getCategoryName()，品牌：@p.getBandName()</p>
                    <p>销售级别：@p.getSellLevelName()</p>
                </div>
            </div>
        </div>
    </div>
	}}else{
	<div><i class="fa fa-exclamation-circle"></i>暂无需要初始化库存的产品</div>
	}
</div>
@section(form1){
<form id="jsInitForm" action="batchInit.json" method="post" class="page-type-form">
	<div class="x_panel page-footer">
		<div class="row form-horizontal">
			<div class="col-sm-4 form-group">
				<label class="control-label col-sm-4 col-xs-12">库存数</label>
				<div class="col-sm-8 col-xs-12">
					<input type="text" name="quantity" placeholder="库存数" class="form-control" required="required">
				</div>
			</div>
            <div class="col-sm-4 form-group">
                <label class="control-label col-sm-4 col-xs-12">价格</label>
                <div class="col-sm-8 col-xs-12">
                    <input type="text" name="price" placeholder="价格" class="form-control" required="required">
                </div>
            </div>
			<div class="col-sm-4 form-group">
				<button id="jsBtnSave" type="submit" class="btn btn-success btn-lg">提交</button>
			</div>
		</div>
	</div>
</form>
}
@section(script1){
<script type="text/javascript">
	$("#jsBtnSave").click(function(){
    	$("#jsInitForm :checkbox").remove();
		$("#jsInitForm").append($(".product-item :checkbox:checked").clone().hide());
	});
</script>
}